package ch.inputRoute;

import java.util.List;

import android.graphics.drawable.Drawable;
import android.location.Location;
import android.location.LocationListener;
import android.os.Bundle;


import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapController;
import com.google.android.maps.OverlayItem;

public class GeoUpdateHandler implements LocationListener {

	private final MapController mMapController;
	private final PositionOverlay mPositionOverlay;

	public GeoUpdateHandler(MapController mapController,
			PositionOverlay positionOVerlay) {
		this.mMapController = mapController;
		mPositionOverlay = positionOVerlay;
	}

	@Override
	public void onLocationChanged(Location location) {
		int lat = (int) (location.getLatitude() * 1E6);
		int lng = (int) (location.getLongitude() * 1E6);
		GeoPoint point = new GeoPoint(lat, lng);
		// 21 = Max. zoom level
		mMapController.animateTo(point);
		// mapController.setCenter(point);

		OverlayItem overlayitem = new OverlayItem(point, "Ihre aktuelle Position",
				"Hallo :)");
		mPositionOverlay.addOverlay(overlayitem);
	}

	@Override
	public void onProviderDisabled(String provider) {
		// TODO Auto-generated method stub

	}

	@Override
	public void onProviderEnabled(String provider) {
		// TODO Auto-generated method stub

	}

	@Override
	public void onStatusChanged(String provider, int status, Bundle extras) {
		// TODO Auto-generated method stub

	}

}
